# Makefile to wrap cargo

all:
	cargo build

check:
	cargo test

clean:
	cargo clean

real-clean: clean
	$(RM) $(FILES_GZ)
	$(RM) $(FILES)

dist:
	cargo package

# Download data set files

FILES := \
  train-images-idx3-ubyte \
  train-labels-idx1-ubyte \
  t10k-images-idx3-ubyte \
  t10k-labels-idx1-ubyte

FILES_GZ := $(addsuffix .gz,$(FILES))

$(FILES_GZ) :
	curl -s -O http://yann.lecun.com/exdb/mnist/$@

$(FILES) : % : %.gz %.gz.sha256
	shasum -c $(addsuffix .sha256,$<)
	gunzip -k $<

download: $(FILES)
